package applet.source;

//
//  ExtensionFilter.java
//  TestAppletXcode
//
//  Created by Thibaud PIQUET on 11/03/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

import java.io.File;
import javax.swing.*;
import javax.swing.filechooser.*;

/** *
 * @author Thibaud PIQUET
 * Version 1.1, Krishen SOOBRAYEN : 05/04/2011 : Inclure le format Graphml
 */
public class ExtensionFilter extends FileFilter {
	
    public boolean accept(File f) {
        if (f.isDirectory()) {
            return true;
        }
		
        String extension = Utils.getExtension(f);
        if (extension != null) {
            if (extension.equals(Utils.tcl) ||
                extension.equals(Utils.TCL) ||
                extension.equals(Utils.graphml) ||
                extension.equals(Utils.GRAPHML) ||
                extension.equals(Utils.rig) ||
                extension.equals(Utils.RIG) ||
                extension.equals(Utils.xml) ||
                extension.equals(Utils.XML) ||
		extension.equals(Utils.net) ||
		extension.equals(Utils.NET) ||
		extension.equals(Utils.BRITE) ||
		extension.equals(Utils.gml) ||
                extension.equals(Utils.GML) ||
		extension.equals(Utils.graphe) ||
                extension.equals(Utils.GRAPHE)) {
				return true;
            } else {
                return false;
            }
        }
		
        return false;
    }
	
    public String getDescription() {
        return "Topology Network format files";
    }
}
